home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_lrm / chape.doc < prev    next >
Text File  |  1996-01-30  |  20KB  |  926 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.                              E. Syntax Summary
  12.  
  13.  
  14.  
  15.  
  16.     2.1
  17.  
  18.     graphic_character ::= basic_graphic_character
  19.        | lower_case_letter | other_special_character
  20.  
  21.     basic_graphic_character ::=
  22.          upper_case_letter | digit
  23.        | special_character | space_character
  24.  
  25.     basic_character ::=
  26.          basic_graphic_character | format_effector
  27.  
  28.     2.3
  29.  
  30.     identifier ::=
  31.        letter {[underline] letter_or_digit}
  32.  
  33.     letter_or_digit ::= letter | digit
  34.  
  35.     letter ::= upper_case_letter | lower_case_letter
  36.  
  37.     2.4
  38.  
  39.     numeric_literal ::= decimal_literal | based_literal
  40.  
  41.     2.4.1
  42.  
  43.     decimal_literal ::= integer [.integer] [exponent]
  44.  
  45.     integer ::= digit {[underline] digit}
  46.  
  47.     exponent ::= E [+] integer | E - integer
  48.  
  49.     2.4.2
  50.  
  51.     based_literal ::=
  52.        base # based_integer [.based_integer] # [exponent]
  53.  
  54.     base ::= integer
  55.  
  56.     based_integer ::=
  57.        extended_digit {[underline] extended_digit}
  58.  
  59.     extended_digit ::= digit | letter
  60.  
  61.  
  62.  
  63.                                    E - 1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.     2.5
  73.  
  74.     character_literal ::= 'graphic_character'
  75.  
  76.     2.6
  77.  
  78.     string_literal ::= "{graphic_character}"
  79.  
  80.     2.8
  81.  
  82.     pragma ::=
  83.        pragma identifier [(argument_association
  84.                                {, argument_association})];
  85.  
  86.     argument_association ::=
  87.          [argument_identifier =>] name
  88.        | [argument_identifier =>] expression
  89.  
  90.     3.1
  91.  
  92.     basic_declaration ::=
  93.          object_declaration     | number_declaration
  94.        | type_declaration       | subtype_declaration
  95.        | subprogram_declaration | package_declaration
  96.        | task_declaration       | generic_declaration
  97.        | exception_declaration  | generic_instantiation
  98.        | renaming_declaration   | deferred_constant_declaration
  99.  
  100.     3.2
  101.  
  102.     object_declaration ::=
  103.          identifier_list : [constant] subtype_indication [:= expression];
  104.        | identifier_list : [constant] constrained_array_definition
  105.                                                          [:= expression];
  106.  
  107.     number_declaration ::=
  108.          identifier_list : constant := universal_static_expression;
  109.  
  110.     identifier_list ::=  identifier {, identifier}
  111.  
  112.     3.3.1
  113.  
  114.     type_declaration ::=  full_type_declaration
  115.        | incomplete_type_declaration | private_type_declaration
  116.  
  117.     full_type_declaration ::=
  118.      type identifier [discriminant_part] is type_definition;
  119.  
  120.     type_definition ::=
  121.          enumeration_type_definition | integer_type_definition
  122.        | real_type_definition        | array_type_definition
  123.        | record_type_definition      | access_type_definition
  124.        | derived_type_definition
  125.  
  126.  
  127.  
  128.  
  129.                                    E - 2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.     3.3.2
  139.  
  140.     subtype_declaration ::=
  141.        subtype identifier is subtype_indication;
  142.  
  143.     subtype_indication ::=  type_mark [constraint]
  144.  
  145.     type_mark ::= type_name | subtype_name
  146.  
  147.     constraint ::=
  148.          range_constraint       | floating_point_constraint
  149.        | fixed_point_constraint | index_constraint
  150.        | discriminant_constraint
  151.  
  152.     3.4
  153.  
  154.     derived_type_definition ::= new subtype_indication
  155.  
  156.     3.5
  157.  
  158.     range_constraint ::=  range range
  159.  
  160.     range ::=  range_attribute
  161.        | simple_expression .. simple_expression
  162.  
  163.     3.5.1
  164.  
  165.     enumeration_type_definition ::=
  166.        (enumeration_literal_specification
  167.           {, enumeration_literal_specification})
  168.  
  169.     enumeration_literal_specification ::=  enumeration_literal
  170.  
  171.     enumeration_literal ::=  identifier | character_literal
  172.  
  173.     3.5.4
  174.  
  175.     integer_type_definition ::=  range_constraint
  176.  
  177.     3.5.6
  178.  
  179.     real_type_definition ::=
  180.        floating_point_constraint | fixed_point_constraint
  181.  
  182.     3.5.7
  183.  
  184.     floating_point_constraint ::=
  185.        floating_accuracy_definition [range_constraint]
  186.  
  187.     floating_accuracy_definition ::=
  188.        digits static_simple_expression
  189.  
  190.     3.5.9
  191.  
  192.  
  193.  
  194.  
  195.                                    E - 3
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.     fixed_point_constraint ::=
  205.        fixed_accuracy_definition [range_constraint]
  206.  
  207.     fixed_accuracy_definition ::=
  208.        delta static_simple_expression
  209.  
  210.     3.6
  211.  
  212.     array_type_definition ::=
  213.        unconstrained_array_definition | constrained_array_definition
  214.  
  215.     unconstrained_array_definition ::=
  216.        array(index_subtype_definition {, index_subtype_definition}) of
  217.                 component_subtype_indication
  218.  
  219.     constrained_array_definition ::=
  220.        array index_constraint of component_subtype_indication
  221.  
  222.     index_subtype_definition ::= type_mark range <>
  223.  
  224.     index_constraint ::=  (discrete_range {, discrete_range})
  225.  
  226.     discrete_range ::= discrete_subtype_indication | range
  227.  
  228.     3.7
  229.  
  230.     record_type_definition ::=
  231.        record
  232.           component_list
  233.        end record
  234.  
  235.     component_list ::=
  236.           component_declaration {component_declaration}
  237.        | {component_declaration} variant_part
  238.        |  null;
  239.  
  240.     component_declaration ::=
  241.        identifier_list : component_subtype_definition [:= expression];
  242.  
  243.     component_subtype_definition ::=  subtype_indication
  244.  
  245.     3.7.1
  246.  
  247.     discriminant_part ::=
  248.        (discriminant_specification {; discriminant_specification})
  249.  
  250.     discriminant_specification ::=
  251.        identifier_list : type_mark [:= expression]
  252.  
  253.     3.7.2
  254.  
  255.     discriminant_constraint ::=
  256.        (discriminant_association {, discriminant_association})
  257.  
  258.  
  259.  
  260.  
  261.                                    E - 4
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.     discriminant_association ::=
  271.        [discriminant_simple_name {| discriminant_simple_name} =>]
  272.                 expression
  273.  
  274.     3.7.3
  275.  
  276.     variant_part ::=
  277.        case discriminant_simple_name is
  278.            variant
  279.           {variant}
  280.        end case;
  281.  
  282.     variant ::=
  283.        when choice {| choice} =>
  284.           component_list
  285.  
  286.     choice ::= simple_expression
  287.        | discrete_range | others | component_simple_name
  288.  
  289.     3.8
  290.  
  291.     access_type_definition ::= access subtype_indication
  292.  
  293.     3.8.1
  294.  
  295.     incomplete_type_declaration ::=
  296.        type identifier [discriminant_part];
  297.  
  298.     3.9
  299.  
  300.     declarative_part ::=
  301.        {basic_declarative_item} {later_declarative_item}
  302.  
  303.     basic_declarative_item ::= basic_declaration
  304.        | representation_clause | use_clause
  305.  
  306.     later_declarative_item ::= body
  307.        | subprogram_declaration | package_declaration
  308.        | task_declaration       | generic_declaration
  309.        | use_clause             | generic_instantiation
  310.  
  311.     body ::= proper_body | body_stub
  312.  
  313.     proper_body ::=
  314.        subprogram_body | package_body | task_body
  315.  
  316.     4.1
  317.  
  318.     name ::= simple_name
  319.        | character_literal  | operator_symbol
  320.        | indexed_component  | slice
  321.        | selected_component | attribute
  322.  
  323.     simple_name ::= identifier
  324.  
  325.  
  326.  
  327.                                    E - 5
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.     prefix ::= name | function_call
  337.  
  338.     4.1.1
  339.  
  340.     indexed_component ::= prefix(expression {, expression})
  341.  
  342.     4.1.2
  343.  
  344.     slice ::= prefix(discrete_range)
  345.  
  346.     4.1.3
  347.  
  348.     selected_component ::= prefix.selector
  349.  
  350.     selector ::= simple_name
  351.        | character_literal | operator_symbol | all
  352.  
  353.     4.1.4
  354.  
  355.     attribute ::= prefix'attribute_designator
  356.  
  357.     attribute_designator ::=
  358.        simple_name [(universal_static_expression)]
  359.  
  360.     4.3
  361.  
  362.     aggregate ::=
  363.        (component_association {, component_association})
  364.  
  365.     component_association ::=
  366.        [choice {| choice} => ] expression
  367.  
  368.     4.4
  369.  
  370.     expression ::=
  371.          relation {and relation} | relation {and then relation}
  372.        | relation {or relation}  | relation {or else relation}
  373.        | relation {xor relation}
  374.  
  375.     relation ::=
  376.          simple_expression [relational_operator simple_expression]
  377.        | simple_expression [not] in range
  378.        | simple_expression [not] in type_mark
  379.  
  380.     simple_expression ::=
  381.        [unary_adding_operator] term {binary_adding_operator term}
  382.  
  383.     term ::= factor {multiplying_operator factor}
  384.  
  385.     factor ::= primary [** primary] | abs primary | not primary
  386.  
  387.     primary ::=
  388.          numeric_literal | null | aggregate | string_literal
  389.        | name | allocator | function_call | type_conversion
  390.        | qualified_expression | (expression)
  391.  
  392.  
  393.                                    E - 6
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.     4.5
  403.  
  404.     logical_operator  ::=  and | or | xor
  405.  
  406.     relational_operator  ::=  = | /= | < | <= | > | >=
  407.  
  408.     binary_adding_operator  ::=  + | - | &
  409.  
  410.     unary_adding_operator  ::=  + | -
  411.  
  412.     multiplying_operator  ::=  * | / | mod | rem
  413.  
  414.     highest_precedence_operator  ::=  ** | abs | not
  415.  
  416.     4.6
  417.  
  418.     type_conversion ::= type_mark(expression)
  419.  
  420.     4.7
  421.  
  422.     qualified_expression ::=
  423.        type_mark'(expression) | type_mark'aggregate
  424.  
  425.     4.8
  426.  
  427.     allocator ::=
  428.        new subtype_indication | new qualified_expression
  429.  
  430.     5.1
  431.  
  432.     sequence_of_statements ::= statement {statement}
  433.  
  434.     statement ::=
  435.        {label} simple_statement | {label} compound_statement
  436.  
  437.     simple_statement ::= null_statement
  438.        | assignment_statement | procedure_call_statement
  439.        | exit_statement       | return_statement
  440.        | goto_statement       | entry_call_statement
  441.        | delay_statement      | abort_statement
  442.        | raise_statement      | code_statement
  443.  
  444.     compound_statement ::=
  445.          if_statement     | case_statement
  446.        | loop_statement   | block_statement
  447.        | accept_statement | select_statement
  448.  
  449.     label ::= <<label_simple_name>>
  450.  
  451.     null_statement ::= null;
  452.  
  453.     5.2
  454.  
  455.     assignment_statement ::=
  456.        variable_name := expression;
  457.  
  458.  
  459.                                    E - 7
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.     5.3
  469.  
  470.     if_statement ::=
  471.         if condition then
  472.           sequence_of_statements
  473.        {elsif condition then
  474.           sequence_of_statements}
  475.        [else
  476.           sequence_of_statements]
  477.         end if;
  478.  
  479.     condition ::= boolean_expression
  480.  
  481.     5.4
  482.  
  483.     case_statement ::=
  484.        case expression is
  485.            case_statement_alternative
  486.           {case_statement_alternative}
  487.        end case;
  488.  
  489.     case_statement_alternative ::=
  490.        when choice {| choice } =>
  491.           sequence_of_statements
  492.  
  493.     5.5
  494.  
  495.     loop_statement ::=
  496.        [loop_simple_name:]
  497.           [iteration_scheme] loop
  498.              sequence_of_statements
  499.            end loop [loop_simple_name];
  500.  
  501.     iteration_scheme ::= while condition
  502.        | for loop_parameter_specification
  503.  
  504.     loop_parameter_specification ::=
  505.        identifier in [reverse] discrete_range
  506.  
  507.     5.6
  508.  
  509.     block_statement ::=
  510.        [block_simple_name:]
  511.           [declare
  512.                declarative_part]
  513.            begin
  514.                sequence_of_statements
  515.           [exception
  516.                exception_handler
  517.               {exception_handler}]
  518.            end [block_simple_name];
  519.  
  520.     5.7
  521.  
  522.  
  523.  
  524.  
  525.                                    E - 8
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.     exit_statement ::=
  535.        exit [loop_name] [when condition];
  536.  
  537.     5.8
  538.  
  539.     return_statement ::= return [expression];
  540.  
  541.     5.9
  542.  
  543.     goto_statement ::= goto label_name;
  544.  
  545.     6.1
  546.  
  547.     subprogram_declaration ::= subprogram_specification;
  548.  
  549.     subprogram_specification ::=
  550.          procedure identifier [formal_part]
  551.        | function designator  [formal_part] return type_mark
  552.  
  553.     designator ::= identifier | operator_symbol
  554.  
  555.     operator_symbol ::= string_literal
  556.  
  557.     formal_part ::=
  558.        (parameter_specification {; parameter_specification})
  559.  
  560.     parameter_specification ::=
  561.        identifier_list : mode type_mark [:= expression]
  562.  
  563.     mode ::= [in] | in out | out
  564.  
  565.     6.3
  566.  
  567.     subprogram_body ::=
  568.         subprogram_specification is
  569.            [declarative_part]
  570.         begin
  571.             sequence_of_statements
  572.        [exception
  573.             exception_handler
  574.            {exception_handler}]
  575.         end [designator];
  576.  
  577.     6.4
  578.  
  579.     procedure_call_statement ::=
  580.        procedure_name [actual_parameter_part];
  581.  
  582.     function_call ::=
  583.        function_name [actual_parameter_part]
  584.  
  585.     actual_parameter_part ::=
  586.        (parameter_association {, parameter_association})
  587.  
  588.  
  589.  
  590.  
  591.                                    E - 9
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.     parameter_association ::=
  601.        [formal_parameter =>] actual_parameter
  602.  
  603.     formal_parameter ::= parameter_simple_name
  604.  
  605.     actual_parameter ::=
  606.        expression | variable_name | type_mark(variable_name)
  607.  
  608.     7.1
  609.  
  610.     package_declaration ::= package_specification;
  611.  
  612.     package_specification ::=
  613.         package identifier is
  614.           {basic_declarative_item}
  615.        [private
  616.           {basic_declarative_item}]
  617.         end [package_simple_name]
  618.  
  619.     package_body ::=
  620.         package body package_simple_name is
  621.            [declarative_part]
  622.        [begin
  623.             sequence_of_statements
  624.        [exception
  625.             exception_handler
  626.            {exception_handler}]]
  627.         end [package_simple_name];
  628.  
  629.     7.4
  630.  
  631.     private_type_declaration ::=
  632.        type identifier [discriminant_part] is [limited] private;
  633.  
  634.     deferred_constant_declaration ::=
  635.        identifier_list : constant type_mark;
  636.  
  637.     8.4
  638.  
  639.     use_clause ::= use package_name {, package_name};
  640.  
  641.     8.5
  642.  
  643.     renaming_declaration ::=
  644.          identifier : type_mark   renames object_name;
  645.        | identifier : exception   renames exception_name;
  646.        | package identifier       renames package_name;
  647.        | subprogram_specification renames subprogram_or_entry_name;
  648.  
  649.     9.1
  650.  
  651.     task_declaration ::= task_specification;
  652.  
  653.     task_specification ::=
  654.        task [type] identifier [is
  655.  
  656.  
  657.                                   E - 10
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.           {entry_declaration}
  667.           {representation_clause}
  668.        end [task_simple_name]]
  669.  
  670.     task_body ::=
  671.         task body task_simple_name is
  672.            [declarative_part]
  673.         begin
  674.             sequence_of_statements
  675.        [exception
  676.             exception_handler
  677.            {exception_handler}]
  678.         end [task_simple_name];
  679.  
  680.     9.5
  681.  
  682.     entry_declaration ::=
  683.        entry identifier [(discrete_range)] [formal_part];
  684.  
  685.     entry_call_statement ::=
  686.        entry_name [actual_parameter_part];
  687.  
  688.     accept_statement ::=
  689.        accept entry_simple_name [(entry_index)] [formal_part] [do
  690.           sequence_of_statements
  691.        end [entry_simple_name]];
  692.  
  693.     entry_index ::= expression
  694.  
  695.     9.6
  696.  
  697.     delay_statement ::= delay simple_expression;
  698.  
  699.     9.7
  700.  
  701.     select_statement ::= selective_wait
  702.        | conditional_entry_call | timed_entry_call
  703.  
  704.     9.7.1
  705.  
  706.     selective_wait ::=
  707.         select
  708.           select_alternative
  709.        {or
  710.           select_alternative}
  711.        [else
  712.           sequence_of_statements]
  713.         end select;
  714.  
  715.     select_alternative ::=
  716.        [when condition =>]
  717.           selective_wait_alternative
  718.  
  719.     selective_wait_alternative ::= accept_alternative
  720.        | delay_alternative | terminate_alternative
  721.  
  722.  
  723.                                   E - 11
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.     accept_alternative  ::=
  733.        accept_statement [sequence_of_statements]
  734.  
  735.     delay_alternative  ::=
  736.        delay_statement [sequence_of_statements]
  737.  
  738.     terminate_alternative ::= terminate;
  739.  
  740.     9.7.2
  741.  
  742.     conditional_entry_call ::=
  743.        select
  744.            entry_call_statement
  745.           [sequence_of_statements]
  746.        else
  747.            sequence_of_statements
  748.        end select;
  749.  
  750.     9.7.3
  751.  
  752.     timed_entry_call ::=
  753.        select
  754.            entry_call_statement
  755.           [sequence_of_statements]
  756.        or
  757.            delay_alternative
  758.        end select;
  759.  
  760.     9.10
  761.  
  762.     abort_statement ::= abort task_name {, task_name};
  763.  
  764.     10.1
  765.  
  766.     compilation ::= {compilation_unit}
  767.  
  768.     compilation_unit ::=
  769.          context_clause library_unit
  770.        | context_clause secondary_unit
  771.  
  772.     library_unit ::=
  773.          subprogram_declaration | package_declaration
  774.        | generic_declaration    | generic_instantiation
  775.        | subprogram_body
  776.  
  777.     secondary_unit ::= library_unit_body | subunit
  778.  
  779.     library_unit_body ::= subprogram_body | package_body
  780.  
  781.     10.1.1
  782.  
  783.     context_clause ::= {with_clause {use_clause}}
  784.  
  785.     with_clause ::=
  786.        with unit_simple_name {, unit_simple_name};
  787.  
  788.  
  789.                                   E - 12
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.     10.2
  799.  
  800.     body_stub ::=
  801.          subprogram_specification is separate;
  802.        | package body package_simple_name is separate;
  803.        | task body task_simple_name is separate;
  804.  
  805.     subunit ::= separate (parent_unit_name) proper_body
  806.  
  807.     11.1
  808.  
  809.     exception_declaration ::= identifier_list : exception;
  810.  
  811.     11.2
  812.  
  813.     exception_handler ::=
  814.        when exception_choice {| exception_choice} =>
  815.           sequence_of_statements
  816.  
  817.     exception_choice ::= exception_name | others
  818.  
  819.     11.3
  820.  
  821.     raise_statement ::= raise [exception_name];
  822.  
  823.     12.1
  824.  
  825.     generic_declaration ::= generic_specification;
  826.  
  827.     generic_specification ::=
  828.          generic_formal_part subprogram_specification
  829.        | generic_formal_part package_specification
  830.  
  831.     generic_formal_part ::= generic {generic_parameter_declaration}
  832.  
  833.     generic_parameter_declaration ::=
  834.          identifier_list : [in [out]] type_mark [:= expression];
  835.        | type identifier is generic_type_definition;
  836.        | private_type_declaration
  837.        | with subprogram_specification [is name];
  838.        | with subprogram_specification [is <>];
  839.  
  840.     generic_type_definition ::=
  841.          (<>) | range <> | digits <> | delta <>
  842.        | array_type_definition | access_type_definition
  843.  
  844.     12.3
  845.  
  846.     generic_instantiation ::=
  847.          package identifier is
  848.              new generic_package_name [generic_actual_part];
  849.        | procedure identifier is
  850.              new generic_procedure_name [generic_actual_part];
  851.        | function designator is
  852.              new generic_function_name [generic_actual_part];
  853.  
  854.  
  855.                                   E - 13
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.     generic_actual_part ::=
  865.        (generic_association {, generic_association})
  866.  
  867.     generic_association ::=
  868.        [generic_formal_parameter =>] generic_actual_parameter
  869.  
  870.     generic_formal_parameter ::=
  871.        parameter_simple_name | operator_symbol
  872.  
  873.     generic_actual_parameter ::= expression | variable_name
  874.        | subprogram_name | entry_name | type_mark
  875.  
  876.     13.1
  877.  
  878.     representation_clause ::=
  879.          type_representation_clause | address_clause
  880.  
  881.     type_representation_clause ::= length_clause
  882.        | enumeration_representation_clause
  883.        | record_representation_clause
  884.  
  885.     13.2
  886.  
  887.     length_clause ::= for attribute use simple_expression;
  888.  
  889.     13.3
  890.  
  891.     enumeration_representation_clause ::=
  892.        for type_simple_name use aggregate;
  893.  
  894.     13.4
  895.  
  896.     record_representation_clause ::=
  897.        for type_simple_name use
  898.           record [alignment_clause]
  899.              {component_clause}
  900.           end record;
  901.  
  902.     alignment_clause ::= at mod static_simple_expression;
  903.  
  904.     component_clause ::=
  905.        component_name at static_simple_expression
  906.                       range static_range;
  907.  
  908.     13.5
  909.  
  910.     address_clause ::=
  911.        for simple_name use at simple_expression;
  912.  
  913.     13.8
  914.  
  915.     code_statement ::= type_mark'record_aggregate;
  916.  
  917.  
  918.  
  919.  
  920.  
  921.                                   E - 14
  922.  
  923.  
  924.  
  925.  
  926.